#include <stdio.h>

#include <devices/gpio.h>


int
	main(
		int argc, char *argv[])
{
	struct gpiodev *dev;

	if (argc != 2) {
		printf("Usage: %s: gpionum\n", argv[0]);
		return -1;
	}

	dev = gpiodev_construct(atoi(argv[1]));
	if (NULL == dev) {
		printf("gpio_construct error\n");
		return -1;
	}
	if (gpiodev_export(dev) < 0) {
		printf("gpiodev_export error\n");
		gpiodev_deconstruct(dev);
		return -1;
	}

	gpiodev_setdir(dev, 1);
	printf("%d\n", gpiodev_getval(dev));
	return 0;
}
